package org.mullin.stratego.server;

import java.util.ArrayList;
import java.util.List;

import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;

@Entity
public class Player {

	@Id String email;
	
	String name;
	List<Long> matches = new ArrayList<Long>();
	List<String> connections = new ArrayList<String>();
	int numConnections;
	
	@SuppressWarnings("unused")
	private Player() { }
	
	public Player(String email) {
		this(email, 1);
	}
	
	public Player(String email, int numConnections) {
		this.email = email;
		this.numConnections = numConnections;
	}
	
	public void addMatch(long matchId) {
		matches.add(matchId);
	}
	
	public boolean removeMatch(long matchId) {
		return matches.remove(matchId);
	}
	
	public List<Long> getMatches() {
		return matches;
	}
	
	public void addConnection() {
		numConnections++;
	}
	
	public void removeConnection() {
		numConnections--;
	}
}
